<?php
	session_start();
	require_once('common/config.php');
	//require_once('../_helper/paging.php');
	//require_once('../_helper/helper.php');
	require_once('../_model/product_model.php');
	
	
	$sql = mysql_query("SELECT * FROM `product_tb` WHERE `type_id` = 14", dbconnect());
	
	$result = array(); 
	while ($product_row = mysql_fetch_assoc($sql)) { 
		$result[] = $product_row;
	} 
	
	foreach($result as $value)
	{
		$order   = array("Dàn máy");
		$name = str_replace($order,'Dàn âm thanh',$value['product_name']);
		
		//echo($name); die();
		
		$sql = "UPDATE `product_tb` 
				SET `product_name` = '$name'
				WHERE `product_id`={$value['product_id']}";
					
		//echo($sql); die();
		$ret = mysql_query($sql, dbconnect());
			
	}
	echo "Finish";

	

?>


